package com.xiegang.servicePrice.generator;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.util.Collections;

/**
 * @author xieGang
 * @description 自动生成代码工具类
 * @date 2023/3/30 14:04
 **/
public class MysqlGenerator {
    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://124.221.221.144:3306/service-price?characterEncoding=utf-8&serverTimezone=GMT%2B8&useSSL=false","root","123456")
                .globalConfig(builder -> {
                    builder.author("xieGang").fileOverride().outputDir("D:\\workspaces\\online-taxi-public\\service-price\\src\\main\\java");
                })
                .packageConfig(builder -> {
                    builder.parent("com.xiegang.servicePrice").pathInfo(Collections.singletonMap(OutputFile.mapperXml,
                            "D:\\workspaces\\online-taxi-public\\service-price\\src\\main\\java\\com\\xiegang\\servicePrice\\mapper"));
                })
                .strategyConfig(builder -> {
                    builder.addInclude("price_rule");
                })
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();

    }
}
